#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 100;
const int M = 1e9 + 7;

int t, k;

int find_first_num(int k)
{
    int l = 1, r = 31650;

    while (l < r)
    {
        int mid = l + r >> 1;
        if ((mid - 1) * (mid - 1) < k && mid * mid >= k)
            return mid;
        else if (mid * mid < k)
            l = mid + 1;
        else
            r = mid ;
    }

    return l;
}

int main()
{
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0);

    cin >> t;
    while (t--)
    {
        cin >> k;
        int r = find_first_num(k), c = 1;

        int start = r * r;
        int step = 0;
        while (start > k)
        {
            if (c < r)
            {
                c++;
            }
            else
            {
                r--;
            }
            start--;
        }

        cout << r << ' ' << c << endl;
    }
    return 0;
}